<script>
  // 获取首次匹配结果
  var str = 'AbC123abc456';
  var reg = /abc/i;   
  reg.exec(str);       
</script>

<script>
  var str = "It's is the shorthand of it is";
  var reg1 = /it/gi;
  str.match(reg1);    
  var reg2 = /^it/gi;
  str.match(reg2);    
  var reg3 = /s/gi;	
  str.match(reg3);   
  var reg4 = /s$/gi;
  str.match(reg4);   
</script>